home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / C64 / U-Utilities / (c)u7.d64 / disk lab.msort (.txt) < prev    next >
Commodore BASIC  |  2008-11-26  |  4KB  |  129 lines

  1. 0 CLR:X$="XX":FORI=.TO3:X$=X$+X$:NEXT
  2. 2 X$=X$+"XXXXXXX":GOTO12
  3. 4 REM**DISK LAB.MSORT BY FRED LAYBERGER
  4. 6 REM**OMAHA,NE - SEP 1985
  5. 8 POKE808,225:A1=PEEK(55):A2=PEEK(56):POKE55,PEEK(51):POKE56,PEEK(52):RETURN
  6. 10 Z=FRE(.):POKE55,A1:POKE56,A2:POKE808,237:RETURN
  7. 12 RESTORE:POKE53280,13:POKE53281,15:P$="[147]WORKING...[151]":PRINTP$
  8. 14 SD=8:DD=8:SR=0:DR=0:SA=4
  9. 16 IFPEEK(1015)<>.THENSD=PEEK(1015):DD=PEEK(1016):SR=PEEK(1017):DR=PEEK(1018):SA=PEEK(1019)
  10. 18 DL=830:IFPEEK(DL)=160THEN24
  11. 20 OPEN1,DD,.,MID$(STR$(DR),2,1)+":DISK LAB.DIR,S,R":FORI=DLTODL+148
  12. 22 INPUT#1,A:POKEI,A:NEXT:CLOSE1
  13. 24 CLOSE15:OPEN15,DD,15:GOSUB522
  14. 26 DIMV$(152):IFPEEK(49152)<>32THENLOAD"DISK LAB.SORT",DD,1:GOSUB522
  15. 28 OPEN1,DD,.,MID$(STR$(DR),2,1)+":\\MASTER*,S,R":GOSUB522
  16. 30 INPUT#1,N:INPUT#1,DT$:INPUT#1,ID$:INPUT#1,BK$:INPUT#1,P:NF=VAL(BK$):ND=N
  17. 32 D$=ID$:ID$="\\"
  18. 34 V$(.)=DT$+ID$+RIGHT$("    "+BK$,4):DIMT$(NF+1)
  19. 36 POKE850,76:POKE851,88:POKE852,3:POKE952,21
  20. 38 GOSUB8:FORI=1TON:SYSDL:V$(I)=LEFT$(X$,16)
  21. 40 PRINT""V$(I):NEXT:GOSUB10:CLOSE1
  22. 42 NF=1:IFP=2THENU=1:I=N+1:V$(I)=" \MSORTED*      ":GOTO48
  23. 44 GOTO150
  24. 46 FORI=1TOND:PRINTP$TAB(20)"DIRECTORY"I"[157] OF"ND
  25. 48 PRINT""V$(I)"[151]"TAB(20)"PROGRAM MAY PAUSE[151]"
  26. 50 CLOSE1:OPEN1,DD,DD,MID$(STR$(DR),2,1)+":"+V$(I)+",S,R":GOSUB522:IFP>1THENI=25
  27. 52 INPUT#1,N:INPUT#1,DT$:INPUT#1,ID$:INPUT#1,BK$:INPUT#1,P:GOSUB8
  28. 54 IFLEFT$(DT$,7)="\MASTER"THENID$="\\"
  29. 56 FORJ=1TON:SYSDL:IFP>1THENT$(NF)=LEFT$(X$,19):GOTO60
  30. 58 T$(NF)=LEFT$(X$,16)+RIGHT$("   "+STR$(I),3)
  31. 60 PRINT""LEFT$(T$(NF),16)TAB(20)"ITEM"NF"[157] OF "RIGHT$(V$(.),4)
  32. 62 IFP>1THENIFJ=ITHENGOSUB10:GOSUB8:I=I+25
  33. 64 NF=NF+1:IFNF>1200THENJ=N:I=ND
  34. 66 NEXT:GOSUB10:IFP>1THENCLOSE1:N=NF-1:GOTO104
  35. 68 NEXT:CLOSE1:N=NF-1:PRINTP$:Z=FRE(.)
  36. 100 PRINT"[147]  SORTING..."N"PROGRAMS"
  37. 102 SYS 49152,N,T$(1):P=2:POKE1015,SD:POKE1016,DD:POKE1017,SR:POKE1018,DR:POKE1019,SA
  38. 104 DT$=LEFT$(V$(.),16):ID$=MID$(V$(.),17,2):BK$=MID$(V$(.),19)
  39. 150 REM ** MAIN MENU
  40. 152 PRINT"[147]DONE -CHOOSE ONE[146][151]"
  41. 154 IFP<2THENPRINT" 1[146] ALPHABETIZE MASTER":IFNF=1THEN162
  42. 156 PRINT" 2[146] PRINT TO SCREEN"
  43. 158 PRINT" 3[146] PRINT TO PRINTER"
  44. 160 IFU<>1THENPRINT" 4[146] SAVE SORTED FILE"
  45. 162 PRINT" 5[146] RETURN TO DISK LABELER+"
  46. 164 PRINT" 6[146] QUIT"
  47. 166 GETA$:IFP<2THENIFA$="1"THEN46
  48. 168 IFNF=1THENIFP<2THEN176
  49. 170 IFA$="2"THENGOSUB502:GOTO150
  50. 172 IFA$="3"THENGOSUB402:GOTO150
  51. 174 IFU<>1THENIFA$="4"THENGOSUB302:GOTO150
  52. 176 IFA$="5"THEN202
  53. 178 IFA$<>"6"THEN166
  54. 180 END
  55. 200 REM ** RETURN TO LABELER
  56. 202 POKE1020,1:PRINT"[147]LOAD "CHR$(34)"DISK LABELER+*"CHR$(34)CHR$(44)DD
  57. 204 PRINT"RUN":POKE198,8:FORI=1TO7:POKE630+I,13:NEXT:PRINT"[151]":NEW
  58. 300 REM *** SAVE
  59. 302 PRINTP$:PRINT#15,"S"+MID$(STR$(DR),2,1)+":?\M*":F$=" \MSORTED       "
  60. 304 ID$=D$
  61. 306 OPEN1,DD,DD,MID$(STR$(DR),2,1)+":"+F$+",S,W":PRINT""F$"[151]"
  62. 308 PRINT#1,N:PRINT#1,DT$:PRINT#1,ID$:PRINT#1,BK$:PRINT#1,P:GOSUB8
  63. 310 FORI=1TON
  64. 312 IFU=1THENT$=V$(I)+"    ":GOTO316
  65. 314 T$=LEFT$(T$(I),16)+LEFT$(RIGHT$(T$(I),3)+"    ",4)
  66. 316 PRINT#1,T$:PRINT""LEFT$(T$,16);
  67. 318 PRINT" ITEM"I"[157] OF"N:NEXT:GOSUB10
  68. 320 CLOSE1:GOSUB522:IFU=1THENN=NF-1:ID$="\\":RETURN
  69. 322 F$="\\MASTER        ":N=ND
  70. 324 U=1:PRINTP$:GOTO306
  71. 400 REM ** PRINT TO PRINTER
  72. 402 PRINT"[147]  PREPARE PRINTER AND ALIGN PAPER [151]":GOSUB516:IFA$="^"THENRETURN
  73. 404 PRINT"  *** WORKING[151] *** DO NOT DISTRUB[146][151] ***"
  74. 406 E$=CHR$(27):S=4:CLOSES:OPENS,S,SA
  75. 408 DEFFNR(X)=INT((IP/CL-INT(IP/CL))*CL+.5):C1$=CHR$(15):C2$=CHR$(18):Z=.:IP=N
  76. 410 H1$=E$+"G"+E$+"E":H2$=E$+"H"+E$+"F"
  77. 412 A=2:E=17:B=8:C=1:D=1:CL=3:PL=56
  78. 414 T1$=C1$+E$+"G":T2$=C2$+E$+"H":PG=PL
  79. 416 P1$="":P9$="-----------------------------------"
  80. 418 PRINT#S,E$"U"CHR$(48);:FORI=1TOCL-1:PRINT#S,P1$SPC(B/A);:NEXT:PRINT#S,P1$
  81. 420 PRINT#S,H1$;:FORI=1TOC:PRINT#S:NEXT
  82. 422 PRINT#S:PRINT#S,SPC(E)CHR$(14)DT$ID$CHR$(20)
  83. 424 PRINT#S,SPC(E)MID$(STR$(VAL(BK$)),2)" BLOCKS FREE - "D$;:PRINT#S,H2$;
  84. 426 X=INT(IP/CL):IFN>PG*CLTHENX=PL:IP=PG*CL
  85. 428 C3=2*X:C4=3*X:C5=4*X:R=FNR(X):IFR>.THENIFR<=CLTHENX=X+1
  86. 430 C3=2*X:C4=3*X:C5=4*X
  87. 432 ONRGOTO436,438:REM **CL=3
  88. 434 GOTO440
  89. 436 C3=X:C4=2*X-1:GOTO440
  90. 438 C4=3*X-1:GOTO440
  91. 440 PRINT#S,T1$
  92. 442 FORI=1TOD:PRINT#S:NEXT:FORI=1TOCL-1:PRINT#S,P9$SPC(B);:NEXT:PRINT#S,P9$
  93. 444 IFZ>.THENC3=C3+Z:C4=C4+Z:C5=C5+Z:IFN<=PG*CLTHENIP=IP+Z
  94. 446 F=16:FORI=1TOX:GETA$:IFA$="^"THENI=X:GOTO500
  95. 448 PRINT#S,LEFT$(T$(I+Z),F)SPC(B-5);
  96. 450 K=VAL(RIGHT$(T$(I+Z),3)):PRINT#S,LEFT$(V$(K),16)SPC(B);
  97. 452 IFC3=>I+X+ZTHENPRINT#S,LEFT$(T$(I+X+Z),F)SPC(B-5);
  98. 454 IFC3=>I+X+ZTHENK=VAL(RIGHT$(T$(I+X+Z),3)):PRINT#S,LEFT$(V$(K),16)SPC(B);
  99. 456 IFI+C3>IPTHENPRINT#S:GOTO476
  100. 458 IFC4=>I+C3THENPRINT#S,LEFT$(T$(I+C3),F)SPC(B-5);
  101. 460 IFC4=>I+C3THENK=VAL(RIGHT$(T$(I+C3),3)):PRINT#S,LEFT$(V$(K),16)SPC(B);
  102. 462 IFI+C4>IPTHENPRINT#S:GOTO476
  103. 464 IFC5=>I+C4THENPRINT#S,LEFT$(T$(I+C4),F)SPC(B-5);
  104. 466 IFC5=>I+C4THENK=VAL(RIGHT$(T$(I+C4),3)):PRINT#S,LEFT$(V$(K),16)SPC(B);
  105. 468 IFI+C5>IPTHENPRINT#S:GOTO476
  106. 470 IFC5+X=>I+C5THENPRINT#S,LEFT$(T$(I+C5),F);
  107. 472 IFC5+X=>I+C5THENK=VAL(RIGHT$(T$(I+C5),3)):PRINT#S,LEFT$(V$(K),16)SPC(B);
  108. 474 PRINT#S
  109. 476 NEXT:IFX<PLTHENFORI=1TOINT(PL-X):PRINT#S:NEXT:IFXAND1THENPRINT#S
  110. 478 FORI=1TOCL:PRINT#S,P9$;SPC(B);:NEXT:PRINT#S:PRINT#S
  111. 480 IFN<=PG*CLTHEN500
  112. 482 PRINT#S,T2$:PRINT#S,H1$:FORI=1TOC:PRINT#S:NEXT
  113. 484 PRINT#S,CHR$(14)DT$ID$CHR$(20)" CONTINUED...":PRINT#S,"PAGE#"(PG/PL)+1" - "D$H2$
  114. 486 Z=PG*CL:IP=N-(PG*CL):PG=PG+PL:GOTO426
  115. 500 PRINT#S,T2$;:CLOSES:RETURN
  116. 502 REM *** PRINT TO SCREEN
  117. 504 PRINT"[147]  FILENAME"TAB(23)"DISKNAME[151]"
  118. 506 FORI=1TON
  119. 508 PRINTTAB(2)LEFT$(T$(I),16)TAB(23);
  120. 510 K=VAL(RIGHT$(T$(I),3)):PRINTLEFT$(V$(K),16)
  121. 512 IFPEEK(214)=23THENGOSUB516:PRINT"[147]":IFA$="^"THENI=N:NEXT:RETURN
  122. 514 NEXT
  123. 516 PRINT" PRESS A KEY TO CONTINUE - '^'TO RETURN[146][151]"
  124. 518 GETA$:IFA$=""THEN518
  125. 520 RETURN
  126. 522 INPUT#15,ER,ER$,T,S
  127. 524 IFERTHENPRINT" "ER;ER$;T;S:GOSUB516:END
  128. 526 RETURN
  129.